<?php
include('config.php');
session_start();

if ($_SESSION['access_level'] >= 4) {

	if (!session_is_registered("myusername")) {
		echo "Please log out and back in";
	}

	echo "<table width=\"100%\">";
	echo "<tr><th width=\"75px\">IP Address</th><th width=\"25px\">Port</th><th width=\"75px\">Model</th><th width=\"75px\">Serial</th><th>Description</th><th width=\"100px\">Submitted By</th><th width=\"125px\">Submitted On</th></tr>";
		$faulty_results = mysql_query("SELECT * FROM faulty_occam_ports");

	for ($i = '0'; $row = mysql_fetch_array($faulty_results), $i <= mysql_num_rows($faulty_results); $i++)
        	{
                	//changes the background color of the row based on if the row is even or odd
                	$row_bg_color=($i % 2 == 0) ? "#e5e5e5" : "#ffffff";
		
			$blade_ip = $row['blade_ip'];	
			$device_info = mysql_query("SELECT * FROM devices WHERE device_ip = '$blade_ip'");
			$device = mysql_fetch_array($device_info);

			echo "<tr onMouseOver=\"this.style.background= '#ffff99'\" onMouseOut=\"this.style.background= '$row_bg_color'\" style=\"background: $row_bg_color; border-top: solid 1px #000000\">";
			echo "<td>" . $row['blade_ip'] . "</td>";
			echo "<td>" . $row['port'] . "</td>";
			echo "<td>" . $device['device_type'] . "</td>";
			echo "<td>" . $device['device_serial'] . "</td>";
			echo "<td>" . $row['problem_description'] . "</td>";
			echo "<td>" . $row['submitted_by'] . "</td>";
			echo "<td>" . $row['submitted_on'] . "</td>";
			echo "</tr>";

		}
	echo "</table>";
}
	?>

